#pragma once

#include "/home/nrsl/keti/huangsx/ros_learning/src/apriltag_detction/include/CppLinuxSerial/SerialPort.hpp"
#include <memory>
#include <thread>
#include <atomic>

class RealGimbalController{
 public:
  RealGimbalController(std::string ttyUSB);
  void sendPitch(double pitch_angle);
  void sendYaw(double yaw_angle);
  double getPitch() const;
  double getYaw() const;
  ~RealGimbalController() {}
 private:
  void sendPitchAndYaw(double pitch_angle, double yaw_angle);
  std::unique_ptr<mn::CppLinuxSerial::SerialPort> serial_;
  std::atomic<float> pitch_angle_;
  std::atomic<float> yaw_angle_; 
  float curr_pitch_, curr_yaw_;
  std::thread recv_thread_;
  void recvThread();
};
